Dear all,
I am analyzing a multi-record survival dataset where the outcome is time to treatment discontinuation (variable AED_4_trattamenti, with three drug categories). My model includes two key covariates that I hypothesize may act as mediators:
dicOutcome (drug responder vs. non-responder, a proxy for efficacy).
EventiYN (presence/absence of adverse events).
To account for potential time-varying effects, I included interactions between dicOutcome, EventiYN, efficacy, treatments, and the natural log of time (ln_time).
My code is like this:
Results:
I want to estimate how the effect of efficacy (dicOutcome) changes over time (e.g., at 9, 12, 18, and 24 months). However, I’m unsure how to obtain these time-specific hazard ratios.
Margins after survival analysis are tricky (at least for me...).
Can anyone help?
Thank you very much in advance.
I am analyzing a multi-record survival dataset where the outcome is time to treatment discontinuation (variable AED_4_trattamenti, with three drug categories). My model includes two key covariates that I hypothesize may act as mediators:
dicOutcome (drug responder vs. non-responder, a proxy for efficacy).
EventiYN (presence/absence of adverse events).
To account for potential time-varying effects, I included interactions between dicOutcome, EventiYN, efficacy, treatments, and the natural log of time (ln_time).
My code is like this:
Code:
stset followup [pweight=ipws], id(id) failure(OutYN==0) gen lntime = ln(_t) *using AED_4_trattamenti==1 as reference gen trt_bri = AED_4_trattamenti == 0 gen trt_per = AED_4_trattamenti == 2 gen trt_bri_lntime = trt_bri * lntime gen trt_per_lntime = trt_per * lntime gen eventi_lntime = EventiYN * lntime gen dicOut_lntime = dicOutcome * lntime stcox ib1.AED_4_trattamenti i.EventiYN i.dicOutcome trt_bri_lntime trt_per_lntime eventi_lntime dicOut_lntime
Code:
. stcox ib1.AED_4_trattamenti i.EventiYN i.dicOutcome trt_bri_lntime trt_per_lntime eventi_lntime dicOut_lntime Failure _d: OutYN==0 Analysis time _t: followup ID variable: id Weight: [pweight=ipws] (sum of wgt is 2,416.93711814284) Iteration 0: log pseudolikelihood = -1039.5131 Iteration 1: log pseudolikelihood = -967.11543 Iteration 2: log pseudolikelihood = -960.4047 Iteration 3: log pseudolikelihood = -960.33864 Iteration 4: log pseudolikelihood = -960.3386 Refining estimates: Iteration 0: log pseudolikelihood = -960.3386 Cox regression with Breslow method for ties No. of subjects = 779 Number of obs = 2,443 No. of failures = 161 Time at risk = 19,445.4612 Wald chi2(8) = 95.40 Log pseudolikelihood = -960.3386 Prob > chi2 = 0.0000 (Std. err. adjusted for 791 clusters in id) ----------------------------------------------------------------------------------- | Robust _t | Haz. ratio std. err. z P>|z| [95% conf. interval] ------------------+---------------------------------------------------------------- AED_4_trattamenti | Brivaracetam | 122.0669 215.523 2.72 0.007 3.83446 3885.897 Perampanel | 265.4937 438.3501 3.38 0.001 10.43893 6752.31 | 1.EventiYN | 12.74878 11.09015 2.93 0.003 2.317445 70.13385 1.dicOutcome | 9.365561 9.098036 2.30 0.021 1.395233 62.86675 trt_bri_lntime | .1900911 .1123238 -2.81 0.005 .0597023 .6052461 trt_per_lntime | .1401045 .0770955 -3.57 0.000 .0476497 .4119495 eventi_lntime | .459382 .171476 -2.08 0.037 .2210249 .9547873 dicOut_lntime | .2110541 .091465 -3.59 0.000 .0902623 .4934931 -----------------------------------------------------------------------------------
I want to estimate how the effect of efficacy (dicOutcome) changes over time (e.g., at 9, 12, 18, and 24 months). However, I’m unsure how to obtain these time-specific hazard ratios.
Margins after survival analysis are tricky (at least for me...).
Can anyone help?
Thank you very much in advance.
Comment